import rxAjax from '@/assets/js/ajax.js';

//oauth_client_details api接口
export const OauthClientDetailsApi = {};

OauthClientDetailsApi.baseUrl= '/api-user/user/org/oauthClientDetails';
OauthClientDetailsApi.exportUrl= OauthClientDetailsApi.baseUrl + '/listExport';
OauthClientDetailsApi.sysDicUrl= '/api-system/system/core/sysDic';

//查询列表
OauthClientDetailsApi.query=function (parameter) {
  var url= OauthClientDetailsApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
OauthClientDetailsApi.get =function(pkId) {
  var url= OauthClientDetailsApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
OauthClientDetailsApi.save =function(parameter) {
  var url= OauthClientDetailsApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
OauthClientDetailsApi.del =function(parameter) {
  var url= OauthClientDetailsApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

//获取密钥
OauthClientDetailsApi.genSecret =function() {
    var url= OauthClientDetailsApi.baseUrl + '/genSecret';
    return rxAjax.get(url);
}

//根据门户应用ID获取权限
OauthClientDetailsApi.getAppPermission =function(appId) {
    var url= OauthClientDetailsApi.baseUrl + '/getAppPermission?appId='+appId;
    return rxAjax.get(url);
}

//保存权限数据
OauthClientDetailsApi.saveAppPermission =function(parameter) {
    var url='/api-user/user/org/insAppPermission/saveAppPermission';
    return rxAjax.postJson(url,parameter);
}
//获取门户应用 根据当前人
OauthClientDetailsApi.getPortalAppByUser =function() {
    var url= OauthClientDetailsApi.baseUrl + '/getPortalAppByUser';
    return rxAjax.get(url);
}
//查询【应用类型】字典列表
OauthClientDetailsApi.getTopDicByKey=function () {
	var url= OauthClientDetailsApi.sysDicUrl + '/getTopDicByKey?key=clientType';
	return rxAjax.get(url);
}
export  default OauthClientDetailsApi;

